package com.stock.core.task;

import com.stock.api.service.stock.StockCodeService;
import com.stock.comm.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>更新股票代码列表任务</p>
 *
 * @author 张峰 zfvip_it@163.com
 * @createTime: 2016/9/13 16:12
 */
@Service("stockCodeTask")
public class StockCodeTask extends BaseTask {

    private static final Logger LOGGER = LoggerFactory.getLogger(StockCodeTask.class);

    @Resource
    private StockCodeService stockCodeService;

    /**
     * 定时任务处理
     */
    public void run() throws Exception {
        String startDate = DateUtil.getCurrentDatetime();
        stockCodeService.extractStockCode();
        String endDate = DateUtil.getCurrentDatetime();
        LOGGER.info("更新股票代码列表任务耗时：" + DateUtil.dateDiff(startDate, endDate));
    }
}
